<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');

/**
 * Init Model
 *
 */


class Admin_category_model extends CI_Model {

	function __construct(){
		parent::__construct();


	}

	function getCategory($parent_id){
	
		if($parent_id){
			$sql="select * from category where parent_id = $parent_id and status=51 ";
		}else{
			$sql="select * from category where parent_id = 0 and status=51 ";
		}
	
		$result = $this->db->query($sql)->result();
	
		if ($result){
			return $result;
		}
		else{
			return false;
		}
	}
	
	//--GET CATEGORY BY PK (SINHA)--//
	public function get($id){
		$sql="select * from category where id=$id limit 1";
		$result = $this->db->query($sql)->row();
		if($result){
			return $result;
		}else{
			return false;
		}
	}
}